package com.naizhuai.ui.task.adapter;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.naizhuai.R;
import com.naizhuai.ui.components.CircleImageView;
import com.naizhuai.ui.entity.TaskListBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author：lichenxi
 * @date 2018/3/20 16
 * email：525603977@qq.com
 * Fighting
 */
public class TaskStepAdapter extends BaseAdapter {
    private final  static String  HaveRP="0";
    private final  static String  NotHaveRP="1";
//    private List<TaskListBean.CommonTaskList.flowStepBean> mFlowStepBeans;
//
//    public TaskStepAdapter(List<TaskListBean.CommonTaskList.flowStepBean> flowStepBeans) {
//        mFlowStepBeans = flowStepBeans;
//    }

//    @Override
//    public int getCount() {
//        return mFlowStepBeans.size();
//    }
//
//    @Override
//    public TaskListBean.CommonTaskList.flowStepBean getItem(int position) {
//        return mFlowStepBeans.get(position);
//    }

    @Override
    public int getCount() {
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
         return null;
    }
//        TaskStepHolder taskStepHolder;
//        TaskListBean.CommonTaskList.flowStepBean flowStepBean = getItem(position);
//
//        if (convertView == null) {
//            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_operation_flow, parent, false);
//            taskStepHolder = new TaskStepHolder(convertView);
//            convertView.setTag(taskStepHolder);
//        } else {
//            taskStepHolder = (TaskStepHolder) convertView.getTag();
//        }
//        taskStepHolder.stepstate.setText(flowStepBean.getStatusName());
//        if (HaveRP.equals(flowStepBean.getRedPoint())){
//            taskStepHolder.msgNotify.setVisibility(View.VISIBLE);
//        }else{
//            taskStepHolder.msgNotify.setVisibility(View.GONE);
//        }

//        taskStepHolder.img_backgroud.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                if (HaveRP.equals(flowStepBean.getRedPoint())){
//                    flowStepBean.setRedPoint(NotHaveRP);
//                    taskStepHolder.msgNotify.setVisibility(View.GONE);
//                }
//              switch (flowStepBean.getStatus()){
//                  case TaskListBean.PREPARE:
//                      //环节设置页
//                      Intent intent =new Intent(parent.getContext(),StepSettingActivity.class);
//                      parent.getContext().startActivity(intent);
//                      break;
//                  case TaskListBean.COMPLETED:
//                  case TaskListBean.DOING:
//                       //环节参与页
//                      Intent intent1 =new Intent(parent.getContext(),StepJoinActivity.class);
//                      parent.getContext().startActivity(intent1);
//                      break;
//              }

//            }
//        });
//        Glide.with(parent.getContext()).load(flowStepBean.getThumb()).into(taskStepHolder.userAvatar);
//        Glide.with(parent.getContext()).load(flowStepBean.getFlowImage()).into(taskStepHolder.img_backgroud);
//        taskStepHolder.username.setText(flowStepBean.getUsername());
//        taskStepHolder.stepname.setText(flowStepBean.getFlowName());
//        return convertView;
//    }

    static class TaskStepHolder {
        @BindView(R.id.stepstate)
        TextView stepstate;
        @BindView(R.id.msg_notify)
        View msgNotify;
        @BindView(R.id.user_avatar)
        CircleImageView userAvatar;
        @BindView(R.id.username)
        TextView username;
        @BindView(R.id.stepname)
        TextView stepname;
        @BindView(R.id.img_backgroud)
        ImageView img_backgroud;
        TaskStepHolder(View itemView) {
            ButterKnife.bind(this, itemView);
        }
    }

}
